<?php

	/**
	* Top sentence text edti
	* for project Kurtulus Law
	* @author trungdt
	* @since Dec 2
	* @copyright Absoft Viet Nam
	*/
	if (!defined('EXPONENT')) exit('');
	
	if (exponent_users_isAdmin()) {
        $id="";
        if (isset($_REQUEST['id']))
        {
            $id=_to_vietnamese_with_nomark($_REQUEST['id']);
        }
		$top = $db->selectObject('site_topsentence',"ref_location = '{$id}'");
		
        if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
		exponent_forms_initialize();
		
		$form = new form();
		
		if (!isset($top->id)) {
			$top->ref_location = $id;
            $top->content = "";
			$top->title = "";
		}
        
        $form->register('title',"Page title",new textcontrol($top->title));
		$form->register('content',"Top sentence content",new texteditorcontrol($top->content,5,60,false));
        
        $form->meta("id",$top->ref_location);
		$form->register('submit','',new buttongroupcontrol("Save",'',"Cancel"));
		
		$form->meta('action','save');
		$form->meta('module',"topsentencemodule");
        
		$template = new template('topsentencemodule','_edit',$loc);
		$template->assign('form_html',$form->toHTML());
		$template->output();
	} else {
		echo SITE_403_HTML;
	}

?>
